package com.vin.java.thread.examples;

import jdk.nashorn.internal.ir.annotations.Reference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

@RestController
@Slf4j
public class AsyncController {
    @Resource
   private  AsyncService asyncService;


    @GetMapping("/test")
    public  void test(int num ) throws ExecutionException, InterruptedException {

        for(int i=0;i<num;i++) {
            Future<String> future = asyncService.asyncSay(num);
            log.info(future.get());
        }
    }

}
